<template>
	<div>
		<el-dialog
			:title="title"
			:visible.sync="visible"
			:close-on-click-modal="false"
			append-to-body
			width="40%"
			:before-close="dialogBeforeClose"
			@closed="handlerClosed"
		>
			<el-form
				ref="form"
				:model="formData"
				:rules="rules"
				label-width="100px"
				:inline="false"
				size="normal"
			>
				<el-form-item label="工作组名称" prop="workName">
					<el-input v-model="formData.workName" readonly="true" clearable />
				</el-form-item>
				<el-form-item label="所属医院" prop="orgName">
					<el-input v-model="formData.orgName" readonly="true" clearable />
				</el-form-item>
				<el-form-item label="所属科室" prop="deptName">
					<el-input v-model="formData.deptName" readonly="true" clearable />
				</el-form-item>
				<el-form-item label="所属医生" prop="doctorName">
					<el-input v-model="formData.doctorName" readonly="true" clearable />
				</el-form-item>
				<el-form-item label="领衔医生" prop="leadDoctorName">
					<el-input
						v-model="formData.leadDoctorName"
						readonly="true"
						clearable
					/>
				</el-form-item>
				<el-form-item label="组员" prop="workDoctorNames">
					<el-input
						v-model="formData.workDoctorNames"
						readonly="true"
						clearable
					/>
				</el-form-item>
				<el-form-item label="工作组介绍" prop="workIntroduce">
					<el-input
						v-model="formData.workIntroduce"
						type="textarea"
						readonly="true"
						:rows="4"
						clearable
					/>
				</el-form-item>
				<el-form-item label="工作组擅长" prop="workMajor">
					<el-input
						v-model="formData.workMajor"
						type="textarea"
						readonly="true"
						:rows="4"
						clearable
					/>
				</el-form-item>
				<el-form-item>
					<el-button size="medium" @click="handlerCancel"> 取消 </el-button>
				</el-form-item>
			</el-form>
		</el-dialog>
	</div>
</template>

<script>
export default {
	props: {
		visible: {
			type: Boolean,
			default: false,
		},
		title: {
			type: String,
			default: '',
		},
		doctorWork: {
			type: Object,
			default: () => {
				return {}
			},
		},
	},
	data() {
		return {
			rules: {},
		}
	},
	computed: {
		formData() {
			return this.doctorWork
		},
	},
	watch: {},
	methods: {
		dialogBeforeClose() {
			this.$emit('update:visible', false)
		},
		handlerClosed() {
			this.handlerResetFields()
		},
		handlerCancel() {
			this.handlerResetFields()
			this.dialogBeforeClose()
			this.handlerClosed()
		},
		handlerResetFields() {
			this.$nextTick(() => {
				this.$refs['form'].clearValidate()
			})
		},
	},
}
</script>

<style lang="scss" scoped></style>
